<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<meta charset="utf-8" />
	<title></title>
	<link href="../css/bootstrap.min.css" rel="stylesheet">
	<link href="../css/bootstrap-select.css" rel="stylesheet">
	<link href="../css/font-awesome.min.css" rel="stylesheet">
	<link href="../css/JyyCommon.css" rel="stylesheet">
	<link href="../css/JyyTable.css" rel="stylesheet">
	<link href="../css/JyyTree.css" rel="stylesheet">
	<link href="../css/JyyMsgBox.css" rel="stylesheet">
	<script type="text/javascript" src="../js/jquery-3.2.1.js"></script>
	<script type="text/javascript" src="../js/jquery.form.min.js"></script> 
	<script type="text/javascript" src="../js/bootstrap.min.js"></script>
	<script type="text/javascript" src="../js/bootstrap-paginator.min.js"></script>
	<script type="text/javascript" src="../js/bootstrap-select.js"></script>
	<script type="text/javascript" src="../js/JyyCommon.js"></script>
	<script type="text/javascript" src="../js/JyyTable.js"></script>
	<script type="text/javascript" src="../js/JyyTree.js"></script>
	<script type="text/javascript" src="../js/JyyMsgBox.js"></script>
	<script type="text/javascript" src="../js/JyyLoading.js"></script>
	<style>
	.heidenbt{
		display: none
	}
</style>
	<script type="text/javascript">
		var tree = null;
		var table = null;
		var scheme = null;
		var treeCode = null;
		$(function(){
			//加载树组件
			getTreeDatas();
		/* 	var treeData_=gettreedatas();
			ted.push(treeData_);
			var treeData = ted;
			//var treeDatas = getTreeDatas();
			tree = RxTree.init("tree", treeData, {listMode:"tree",draggable:true,checkType:"single", drillType:"1"}, 
					{width:"200px", bottom:"0px", top:"0px", border:"none",borderRight: "1px solid #e0e0e0"}, onTreeEvent);
			tree.expandAll();
			tree.checkNode("102", true); */
		})
		
		function onTreeEvent(event){
			console.log("onTreeEvent");
			var projectId_ =  getQueryString("projectId")||'88888888888';
			var arr = [10,2001,2002];
			if(event.name == "onclick"){
				var data = event.node.data;
				var code = data.code;
				// dactive启动路径
		  //      var url = 'http://123.57.216.230:8081/'+event.node.data.url; 
				var	url = 'http://127.0.0.1:8099/'+data.url;
				if(arr.includes(parseInt(code))) {
					// 系统文件路径
 				//	url = 'http://123.57.216.230:80/'+data.url;
 					url = 'http://127.0.0.1:8099/'+data.url;
				}
				if(!data.url){
					return;
				}else{
					JyyLoading.start();
					$('#sampleIframe').attr('src',url);
					//$('#sampleIframe').attr('src', $('#sampleIframe').attr('src'));
					$("#iframe").css("display","block");
					$('#sampleIframe').on("load",function() { 
						JyyLoading.end();
					}); 

				}
			}
		}
		function getQueryString (name){
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
			var r = window.location.search.substr(1).match(reg);
			return r ? unescape(r[2]) : null;
		}
		function getTreeDatas(){
			var planId =  this.getQueryString("projectId")||'';
			var modelId =  this.getQueryString("modelId")||'';
			var treeData = '';
			if(modelId=='50'){
				treeData = getTreeData(planId);
				tree = RxTree.init("tree", treeData, {listMode:"tree",draggable:true,checkType:"single", drillType:"1"}, 
						{width:"200px", bottom:"0px", top:"0px", border:"none",borderRight: "1px solid #e0e0e0"}, onTreeEvent);
				tree.expandAll();
        	}/* else{
        		$.ajax({
		            type:"POST",
		            url:"../pv/page/pageInfo/menus",
		            data:{sysType:modelId,planId:planId},
		            success:function(data){
		            	var sts=eval("("+data+")");
		            	if(modelId=='50') {
		            		sts.push(getTreeData(planId));
		            	}
	            	    treeData = sts;
		    			tree = RxTree.init("tree", treeData, {listMode:"tree",draggable:true,checkType:"single", drillType:"1"}, 
		    					{width:"200px", bottom:"0px", top:"0px", border:"none",borderRight: "1px solid #e0e0e0"}, onTreeEvent);
		    			tree.expandAll();
		            }
		        });
        	} */
		};

		function getTreeData(planId){
			var userId = "";
			$.ajax({
				url: "../g/service/Sample/getUserId",
				type:'POST',
				cache:false,
				async:false,
				dataType: "json",
				contentType:"application/json",
	            success:function(data){
	            	userId = data;
	            }
			});
			return [{
				"code": "10",
				"name": "自定义查询",
				"draggable": false,
				"isLeaf": true,
				"level": "1",
				"items": [],
				"url": "goptcloud/pages/dataSourceComPar.html?projectId="+planId+"&modelId=50&userId="+userId
			}, {
				"code": "20",
				"name": "专题对比",
				"draggable": false,
				"level": "1",
				"items": [{
					"code": "2001",
					"name": "系统工作位置图",
					"draggable": false,
					"isLeaf": true,
					"level": "2",
					"items": [],
					"url": "goptcloud/pages/dataSourceSysWork.html?projectId="+planId+"&modelId=50&userId="+userId
				},{
					"code": "2002",
					"name": "新能源消纳",
					"draggable": false,
					"isLeaf": true,
					"level": "2",
					"items": [],
					"url": "goptcloud/pages/dataSourceWater.html?projectId="+planId+"&modelId=50&userId="+userId
				}]
			}];
		};
		
	</script>
</head>
<body style="position:absolute;top:0px;left:0px;right:0px;bottom:0px;">
	<div id="tree"></div>
	<div id="iframe" style="position: absolute;top: 0px;left: 200px;right: 0px;height: 99%;display:none">
		<iframe  frameborder="0" width="100%" scrolling="No" height="100%" leftmargin="0" topmargin="0" id="sampleIframe"></iframe>
	</div>
	<form action='../pv/page/pageInfo/202' method='post' id='form2'>
		<input type="hidden" name="schemeid">
	</form>
</body>
</html>